﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserPositions.aspx.cs"
    Inherits="Tradier.UserPositions" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <link rel="stylesheet" type="text/css" href="/Contents/flat-ui/css/vendor/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="/Contents/flat-ui/css/flat-ui.css" />
    <link rel="stylesheet" type="text/css" href="/Contents/css/style.css" />
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div class="trading-template container">
        <%if (Positions != null)
          {
              foreach (var userModel in Positions)
              {
                  
        %>
        <div class="panel-default">
            <div class="panel-heading">
                Account Numner :
                <%=userModel.Key %>
            </div>
            <table>
                <thead>
                    <tr>
                        <th>
                            Symbol
                        </th>
                        <th>
                            Quantity
                        </th>
                        <th>
                            Last
                        </th>
                        <th>
                            Change
                        </th>
                        <th>
                            Value
                        </th>
                        <th>
                            Cost Basis
                        </th>
                        <th>
                            Gain/Loss
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <%foreach (var position in userModel.Value)
                      {
                    %>
                    <tr>
                        <td>
                            <%=position.Symbol%>
                            <%if (position.Type == "option") { %>
                                <br />
                                <small><%=position.Description%></small>
                              <%} %>
                        </td>
                        <td>
                            <%=position.Quantity%>
                        </td>
                         <td>
                            $<%=position.Last%>
                        </td>
                        <td>
                            $<%=Math.Abs(position.Change) %>
                            <br />
                            <%if (position.Last != 0)
                              { %>
                                <small><%=(position.Change/position.Last*100).ToString("F2") %>%</small>
                              <%} %>
                            
                        </td>
                         <td>
                            $<%=Math.Abs(position.Value)%>
                        </td>
                        <td>
                            $<%=Math.Abs(position.CostBasis)%>
                        </td>
                        <td>
                            $<%=Math.Abs(position.GainLoss)%>
                            <br />
                            <small><%=(position.GainLoss / position.CostBasis * 100).ToString("F2")%>%</small>
                        </td>
                    </tr>
                    <%
                      
                      } %>
                    <tr>
                    </tr>
                </tbody>
            </table>
        </div>
        <%
                  }
              }%>
    </div>
    </form>
</body>
</html>
